package com.tdam2011.grupo05.entities.thread;

import java.util.Date;
import java.util.Set;

import android.provider.BaseColumns;

import com.google.common.collect.Sets;
import com.tdam2011.grupo05.entities.Model;
import com.tdam2011.grupo05.entities.contact.ContactWeb;
import com.tdam2011.grupo05.entities.message.MessageWeb;

public class ThreadWeb extends Model {

	public static final String TABLE_NAME = "thread";
	public static final String COL_ID = BaseColumns._ID;
	public static final String COL_ID_USER = "fk_id_user";
	public static final String COL_NAME = "thread_name";
	public static final String COL_TIMESTAMP = "timestamp";
	public static final String COL_ID_ACCOUNT = "fk_id_account";
	public static final String COL_STATE = "state";

	private ContactWeb mUser;
	private String mName;
	private Date mDate;
	private State mState;
	private long idAccount;
	private Set<MessageWeb> mMessages;

	public enum State {
		HAVE_UNREAD, ALL_READED, HAVE_ERRORS
	}

	public ThreadWeb() {
		mMessages = Sets.newLinkedHashSet();
	}

	public void setName(String name) {
		mName = name;
	}

	public String getName() {
		return mName;
	}

	public void setDate(Date mDate) {
		this.mDate = mDate;
	}

	public void setMessages(Set<MessageWeb> m) {
		mMessages = m;
	}

	public void setState(State state) {
		mState = state;
	}

	public void setUser(ContactWeb user) {
		mUser = user;
	}

	public Date getDate() {
		return mDate;
	}

	public Set<MessageWeb> getMessages() {
		return mMessages;
	}

	public State getState() {
		return mState;
	}

	public long getIdAccount() {
		return idAccount;
	}

	public void setIdAccount(long idAccount) {
		this.idAccount = idAccount;
	}

	public ContactWeb getUser() {
		return mUser;
	}
}
